package com.ruoyi.system.service.impl;

import com.ruoyi.system.feign.OrderFeign;
import com.ruoyi.system.feign.ProductFeign;
import com.ruoyi.system.service.ISeataTestService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 参数配置 服务层实现
 *
 * @author ruoyi
 */
@Service
public class SeataTestServiceImpl implements ISeataTestService {

    @Resource
    private OrderFeign orderFeign;

    @Resource
    private ProductFeign productFeign;

    @Override
    @GlobalTransactional
    public Integer createOrder() {
        //去库存
        Integer i1 = orderFeign.reduceStock();
        //改价格
        Integer i2 = productFeign.reducePrice();
        return 1;
    }

}
